home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Apr 90 / MacApp.Tech$ 4⁄20⁄90 / 1154-Re slow TP3-Apr90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.0 KB  |  64 lines  |  [TEXT/GEOL]

  1. Item    5178591                         19-April-90        22:49PDT
  2.  
  3. From:   ANIMATRIXDEV                    Animatrix, Steven Marcus,PRT
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. Sub:    Re - slow TP3
  8.  
  9.  
  10.  
  11. In Quit Command Bugs from CFI of 4-18-90:
  12. > Everything runs ok [with Think Pascal], despite the extreme slowness at
  13. executing my code...
  14.  
  15.  
  16. I too have found that my code slows to a crawl when running in the THINK Pascal
  17. environment. But at least for my situation I have found a fix:
  18.  
  19. My application tends to allocate a large amount of objects and large handles of
  20. permanent data. There is a low level routine in
  21. 'MacApp Source:UMacAppUtilities.p' that gets called every time you use a MacApp
  22. routine to allocate a handle. It is used to clear/init the contents of all
  23. handles. Think Pascal compiles extra code in all the procedures when you run in
  24. its environment and this causes this heavily used routine to become real slow.
  25. The solution was to turn off the extra debug code in this single routine.
  26.  
  27. {$Push}     <-----
  28. {$D-}       <----- I added these
  29.    procedure BlockSet (destPtr: Ptr; byteCount: longint; setVal: univ
  30. SignedByte);
  31.  
  32. { ??? should be improved to do longword setting. }
  33.  
  34.    var
  35.    endPtr: Ptr;
  36.  
  37.    begin
  38.    destPtr := Ptr(StripLong(destPtr));
  39.    endPtr := Ptr(Ord(destPtr) + byteCount);
  40.    while Ord(destPtr) < Ord(endPtr) do
  41.    begin
  42.    destPtr^ := setVal;
  43.    destPtr := Ptr(Ord(destPtr) + 1);
  44.    end;
  45.    end;
  46. {$Pop}      <-----
  47.  
  48.  
  49. This routine should probably be written in asm, but for now things run at an
  50. acceptable debug speed with this change. Note that this means that you will not
  51. be able to set breakpoints in this routine nor will you be able to step into
  52. it.
  53.  
  54. Also I do not know whether this little patch is officially sanctioned etc...
  55. Also, RUMOR has it that you should not mix code that has debug turned on with
  56. code that has debug turned off when using failure handlers. In general I never
  57. turn debug off, except in this ONE case.
  58.  
  59.  
  60. Anything for improved turnaround time,
  61. Steven Marcus@AnimatrixDev
  62.  
  63.  
  64.